from typing import List


# 1. 两数之和
def twoSum(nums: List[int], target: int) -> List[int]:
    num_dict = {}
    for index, value in enumerate(nums):
        target_num = target - value
        target_index = num_dict.get(target_num)
        if target_index is not None:
            return [index, target_index]
        else:
            num_dict[value] = index

nums_1 = [2, 7, 11, 15]
target_1 = 9
result = twoSum(nums_1,target_1)
print(f"result:{result}")
